package org.dna.opdracht3;

import java.util.ArrayList;
import java.util.Collections;

public class Data {

	private ArrayList<Integer> pos = new ArrayList<Integer>();

	public Data(int pos) {
		this.pos.add(pos);
	}

	public ArrayList<Integer> getPos() {
		return pos;
	}
	
	public void print(){
		System.out.println(toString());
	}
	
	public void add(Data data){
		ArrayList<Integer> temp = data.getPos();
		pos.addAll(temp);
	}
	
	public int getCount(){
		return pos.size();
	}
	
	@Override
	public String toString(){
		StringBuffer sBuffer = new StringBuffer();
		sBuffer.append("[ ");
		Collections.sort(pos);
		for(Integer i: pos){
			sBuffer.append(" "+ i + ", ");
		}
		sBuffer.append(" ]");
		return sBuffer.toString();
	}

}
